import abc
from base import conn

class RedisCacheSdk(metaclass=abc.ABCMeta):
    def get(self, key: str):
        return conn.get(key)

    def delete(self, key: str):
        conn.delete(key)

    def batch_get(self, keys: list) ->dict:
        print(conn.mget(keys))
        # pipe = conn.pipeline()
        # for key in keys:
        #     pipe.get(key)
        # result = dict(zip(keys, pipe.execute()))
        # need_load_key = self.filter_empty(result)
        # self.load(need_load_key)
        # return result

    # @abc.abstractstaticmethod
    # def load(need_load_keys: list):
    #     pass
    
    def filter_empty(self, data: dict)->str:
        return filter(lambda key: not data[key], data)

    def batch_delete(self, keys: list):
        for key in keys:
            conn.delete(key)
        

# class 

if __name__ == "__main__":
    redis_batch = RedisCacheSdk()
    data = redis_batch.batch_get(["a", "b", "c"])
